<?php
declare(strict_types=1);
namespace App\Controller\Cash\v1;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middleware;
use App\Middleware\CashMiddleware;
use Laminas\Stdlib\ResponseInterface;
use Service\FaceService\CTIDService;
use Service\FaceService\FaceService;


/**
 * 面部图形
 * @Controller(prefix="/cash/v1/face")
 * @Middleware(CashMiddleware::class)
 */
class FaceController extends AbstractController
{
    /**
     * 识别身份证
     * @RequestMapping(path="ocridcard", methods="POST")
     * @return string[]
     */
    public function ocrIdCard( RequestInterface $request,FaceService $faceService ) 
    {
        
        return $faceService->ocrIdCard($request->getAttribute('cid'),$request->getParsedBody());
    }  
    
    /**
     * 根据身份证号码返回省市区
     * @RequestMapping(path="getidcardarea", methods="POST")
     * @return string[]
     */
    public function getIdcardArea( RequestInterface $request,FaceService $faceService ) 
    {
        
        return $faceService->getAreaByIdcard($request->getParsedBody());
    } 
    
    /**
     * 图形检测
     * @RequestMapping(path="facecheck", methods="POST")
     * @return string[]
     */
    public function faceCheck( RequestInterface $request,FaceService $faceService ) 
    {
        
        return $faceService->faceCheck($request->getAttribute('cid'),$request->getAttribute('mn_sid'),$request->getParsedBody());
    }
    
    /**
     * 图形绑定
     * @RequestMapping(path="facebind", methods="POST")
     * @return string[]
     */
    public function faceBind( RequestInterface $request,FaceService $faceService ) 
    {
        
        return $faceService->faceBind($request->getAttribute('cid'),$request->getAttribute('mn_sid'),$request->getParsedBody());
    }
    
    /**
     * 图形搜索
     * @RequestMapping(path="facesearch", methods="POST")
     * @return string[]
     */
    public function faceSearch( RequestInterface $request,FaceService $faceService ) 
    {
        
        return $faceService->faceSearch($request->getAttribute('cid'),$request->getAttribute('mn_sid'),$request->getParsedBody());
    }

    /**
     * 校验人脸和身份证信息功能
     * @RequestMapping(path="CtidAuthCheck",methods="post")
     * @return \Service\FaceService\type
     */
    public function CtidAuthCheck(RequestInterface $request,CTIDService $CTIDService)
    {
        return $CTIDService->checkFaceAndIdCard($request->getParsedBody());
    }
}
